﻿using UnityEngine;
using System.Collections;

public class Shot: MonoBehaviour
{
	public float speed;
	public float damage = 25f;
	
	void Start ()
	{
				rigidbody.velocity = transform.forward * speed;
		}
	void OnCollisionEnter(Collision collision){
			if(collision.gameObject.tag == "Terrain"){
				Destroy(this.gameObject);
			}
		    
		    else
		    {
			Health h = collision.transform.GetComponent<Health>();
		    
			if (h !=null) {
				h.TakeDamage(damage);
			}
			Destroy(this.gameObject);
		   }
		}

}


